<html>
<head><meta charset="utf-8"><title>Is there a lint for match arm binding in uppercase? · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Is.20there.20a.20lint.20for.20match.20arm.20binding.20in.20uppercase.3F.html">Is there a lint for match arm binding in uppercase?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240788228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Is%20there%20a%20lint%20for%20match%20arm%20binding%20in%20uppercase%3F/near/240788228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emilio González <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Is.20there.20a.20lint.20for.20match.20arm.20binding.20in.20uppercase.3F.html#240788228">(May 31 2021 at 03:43)</a>:</h4>
<p>For example, when you have:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">enum</span> <span class="nc">MyEnum</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">AAA</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">BBB</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">CC</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">use</span><span class="w"> </span><span class="n">MyEnum</span>::<span class="o">*</span><span class="p">;</span><span class="w"></span>

<span class="k">match</span><span class="w"> </span><span class="n">my_enum</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">AAA</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="o">..</span><span class="p">.,</span><span class="w"></span>
<span class="w">    </span><span class="n">BBB</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="o">..</span><span class="p">.,</span><span class="w"></span>
<span class="w">    </span><span class="n">CCC</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="o">..</span><span class="p">.,</span><span class="w"> </span><span class="c1">// &lt;-- new binding, it should be `CC`. Rust throws generic warning about non_snake_case</span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>I want to deny that.</p>
<p>Thanks.</p>



<a name="240805367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Is%20there%20a%20lint%20for%20match%20arm%20binding%20in%20uppercase%3F/near/240805367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Is.20there.20a.20lint.20for.20match.20arm.20binding.20in.20uppercase.3F.html#240805367">(May 31 2021 at 08:22)</a>:</h4>
<p>Not a Clippy lint, but a <code>rustc</code> lint: <code>#!deny(bindings_with_variant_name)]</code> </p>
<p>Also if you do this, you'll get a whole bunch of warnings from <code>rustc</code> already: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=fa57038b74c0bb4ba41ab9f6241bdadf">Playground</a></p>



<a name="240849867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Is%20there%20a%20lint%20for%20match%20arm%20binding%20in%20uppercase%3F/near/240849867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Cameron Steffen <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Is.20there.20a.20lint.20for.20match.20arm.20binding.20in.20uppercase.3F.html#240849867">(May 31 2021 at 16:06)</a>:</h4>
<p><code>bindings_with_variant_name</code> doesn't apply since the name doesn't match. I think you should open a rustc issue to request a an added note for the <code>non_snake_case</code> lint in this case.</p>



<a name="240858023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Is%20there%20a%20lint%20for%20match%20arm%20binding%20in%20uppercase%3F/near/240858023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Is.20there.20a.20lint.20for.20match.20arm.20binding.20in.20uppercase.3F.html#240858023">(May 31 2021 at 17:50)</a>:</h4>
<p>Oh I missed that, thanks for correcting me! Maybe we could add a Clippy lint <code>bindings_with_similar_variant_name</code>?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>